package org.despair2D.ui 
{
	import org.despair2D.core.ns_despair;
	import org.despair2D.debug.Logger;
	import org.despair2D.ui.events.InteractiveEvent;
	import org.despair2D.ui.DespairUI;
	use namespace ns_despair;

	
	///默认-移上-按下(1-3) - 无效(4)
public class Button extends SectionButton 
{
	
	public function Button( classRef:* ) 
	{
		super(classRef);
		
		addLeaveEffectListener(onLeave);
		addHoverEffectListener(onOver);
		addPressEffectListener(onPress);
		addDisableEffectListener(onDisable)
	}
	
	
	
	/**
	 * 按钮片段名字
	 */
	override public function setButtonSection( classRef:* ) : void
	{
		super.setButtonSection(classRef)
		
		if (!m_buttonSection.doesPointerNull(1))
		{
			Logger.reportError(this, 'setButtonSection', '错误按钮片段 (' + m_buttonSection.m_name + ')');
		}
		
		m_overPointer     =  m_buttonSection.doesPointerNull(2) ? 2 : m_leavePointer;
		m_pressPointer    =  m_buttonSection.doesPointerNull(3) ? 3 : m_overPointer;
		m_disablePointer  =  m_buttonSection.doesPointerNull(4) ? 4 : 1;
	}
	
	
	
	
	final ns_despair function onOver() : void
	{
		m_anime.pointer = m_overPointer;
	}
	
	
	final ns_despair function onLeave() : void
	{
		m_anime.pointer = m_leavePointer;
	}
	
	
	final ns_despair function onPress() : void
	{
		m_anime.pointer = m_pressPointer;
	}
	
	
	final ns_despair function onDisable() : void
	{
		m_anime.pointer = m_disablePointer;
	}
	
	
	
	ns_despair var m_leavePointer:int = 1;
	
	ns_despair var m_overPointer:int;
	
	ns_despair var m_pressPointer:int;
	
	ns_despair var m_disablePointer:int;
	
	
}

}